BookTypeForm = Ext.extend(Ext.Window, {
	formPanel : null,
	constructor : function(a) {
		Ext.applyIf(this, a);
		this.initUIComponents();
		BookTypeForm.superclass.constructor.call(this, {
			layout : "fit",
			id : "BookTypeFormWin",
			title : "书籍目录信息",
			iconCls : "menu-department",
			width : 400,
			height : 170,
			minWidth : 399,
			minHeight : 169,
			items : this.formPanel,
			border : false,
			modal : true,
			plain : true,
			buttonAlign : "center",
			buttons : this.buttons
		});
	},
	initUIComponents : function() {
		this.formPanel = new Ext.form.FormPanel( {
			frame : false,
			id : "bookTypeForm",
			bodyStyle : "padding : 5px;",
			layout : "form",
			defaultType : "textfield",
			url : __ctxPath + "/addBookType.do",
			defaultType : "textfield",
			reader : new Ext.data.JsonReader( {
				root : "data"
			}, [ {
				name : "bookCatalogId",
				mapping : "bookCatalogId"
			}, 
			{
				name : "bookCatalogName",
				mapping : "bookCatalogName"
			}, {
				name : "parentId",
				mapping : "parentId"
			} ]),
			defaults : {
				anchor : "95%,95%",
				allowBlank : false,
				selectOnFocus : true,
				msgTarget : "side"
			},
			items : [ {
				xtype : "hidden",
				name : "bookType.bookCatalogId",
				id : "bookCatalogId"
			},
			 {
				xtype : "hidden",
				name : "bookType.parentId",
				id : "parentId",
				value : this.nodeId
			}, {
				fieldLabel : "书籍目录名称",
				name : "bookType.bookCatalogName",
				blankText : "书籍目录名称为必填!",
				id : "bookCatalogName"
			} ]
		});
		this.buttons = [ {
			text : "提交",
			iconCls : "btn-save",
			handler : function() {
				var a = Ext.getCmp("treePanel");
				if (Ext.getCmp("bookTypeForm").getForm().isValid()) {
					Ext.getCmp("bookTypeForm").getForm().submit( {
						waitMsg : "正在提交书籍目录信息",
						success : function(b, c) {
							Ext.ux.Toast.msg("操作信息", "添加书籍目录信息成功！");
							Ext.getCmp("BookTypeFormWin").close();
							a.root.reload();
						}
					});
				}
			}
		}, {
			text : "取消",
			iconCls : "btn-del",
			handler : function() {
				Ext.getCmp("BookTypeFormWin").close();
			}
		} ];
	}
});